<?php

// 只支持POST请求，否则返回405错误
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
   header('HTTP/1.1 405 Method Not Allowed');
   return;
}

// 清除自动登录remember-token
$_SESSION['logout'] = true;

if (isset($_SESSION['user'])) {
  unset($_SESSION['user']);
}
header('Location:'. url('index'));